package cn.xshi.bpm.service.impl;
import java.util.List;
import java.util.Map;

import cn.xshi.bpm.service.LcFieldTypeService;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import org.springframework.stereotype.Service;
import cn.xshi.bpm.dao.LcFieldTypeDao;
import cn.xshi.bpm.model.LcFieldType;
import javax.annotation.Resource;
/**
* @Desc 字段类型 
* @Author 邓纯杰
* @CreateTime 2022-04-04 18:42:35
*/
@Service
public class LcFieldTypeServiceImpl extends BaseService implements LcFieldTypeService {

	@Resource
	private LcFieldTypeDao lcFieldTypeDao;

	/**
	* 分页
	* @param condition 
	* @return
	*/
	public List<LcFieldType> getLcFieldTypeListByCondition(Map<String,Object> condition){
		try{
			return lcFieldTypeDao.getLcFieldTypeListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param id
	* @return
	*/
	public LcFieldType getLcFieldTypeById(String id){
		try{
			LcFieldType lcFieldType = lcFieldTypeDao.getLcFieldTypeById(id);
			return lcFieldType;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param lcFieldType 
	* @return
	*/
	public int addLcFieldType(LcFieldType lcFieldType){
		int i = 0;
		try {
			lcFieldType.setCreateId(getCurrentAccountId());
			lcFieldType.setCreateTime(getDate());
			lcFieldType.setId(toUUID());
			i = lcFieldTypeDao.addLcFieldType(lcFieldType);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param lcFieldType 
	* @return
	*/
	public int updateLcFieldType(LcFieldType lcFieldType){
		int i = 0;
		try {
			lcFieldType.setUpdateId(getCurrentAccountId());
			lcFieldType.setUpdateTime(getDate());
			i = lcFieldTypeDao.updateLcFieldType(lcFieldType);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改（根据动态条件）
	* @param lcFieldType 
	* @return
	*/
	public int updateLcFieldTypeBySelective(LcFieldType lcFieldType){
		int i = 0;
		try {
			i = lcFieldTypeDao.updateLcFieldTypeBySelective(lcFieldType);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delLcFieldType(Map<String,Object> condition){
		int i = 0;
		try {
			i = lcFieldTypeDao.delLcFieldType(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
